package com.springboot.demo.constant;

/**
 * 公共常量
 *
 * @author supu
 * @since 2020-11-19 11:25
 **/
public class CommonConstant {
    /**
     * 本机地址
     */
    public static final String LOCALHOST = "172.16.0.211";
    /**
     * 虚拟机地址
     */
    public static final String VMWARE_HOST = "172.16.0.200";
    /**
     * 虚拟机节点1地址
     */
    public static final String NODE1 = "172.16.0.201";
    /**
     * 虚拟机节点2地址
     */
    public static final String NODE2 = "172.16.0.202";
    /**
     * 虚拟机节点3地址
     */
    public static final String NODE3 = "172.16.0.203";
    /**
     * 本机端口
     */
    public static final int LOCAL_PORT = 9000;

    public static final String LINE = "\n";

    public static String getResponseContent() {
        // 返回数据内容
        StringBuilder stringBuilder = new StringBuilder();
        // 头部
        stringBuilder.append("HTTP/1.1 200 OK").append(CommonConstant.LINE)
//                .append("Content-Type: text/plain; charset=UTF-8")
                        .append("Content-Type: application/json; charset=UTF-8").append(CommonConstant.LINE)
                        .append(CommonConstant.LINE);

        // 消息体，即返回内容
//        stringBuilder.append("hello client");
        stringBuilder.append("{\"userName\":\"zhangsan\",\"age\":20}");
        return stringBuilder.toString();
    }
}
